home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / MCASM.RAR / MC_ASM.EXE / WROX_ASM / CH12 / COMMON / QUANT.H < prev    next >
C/C++ Source or Header  |  1994-09-09  |  1KB  |  40 lines

  1. #ifndef QUANT_H
  2. #define QUANT_H
  3.  
  4. #include <mem.h>
  5. #include "common.h"
  6. #include "graph.h"
  7. #include "grfile.h"
  8. #include "palette.h"
  9. #include "mapper.h"
  10.  
  11. // auxiliar class that hides details of color quantization
  12.  
  13.  
  14. /* RGB to 256 colors */
  15. class color_reductor {
  16. protected:
  17.     color_selector *selector;
  18.     color_mapper *mapper;
  19.     image_keeper *keeper;
  20.     BYTE *tmp_line;   // is used for 256 to 16 colors converting
  21.  
  22.     public:
  23.     BGRpalette my_colormap;
  24.     BOOL initialized, view_pass1, ready_for_pass2;
  25.     graph_file_reader *input_file;
  26.         // data type must be TRUECOLOR! or COLOR256
  27.  
  28.     color_reductor (graph_file_reader *input_file_,
  29.                 BOOL view_pass1_,  int colors);
  30.     // if you set view = TRUE, do not forget set grafics in
  31.     // 256 colors mode!
  32.     virtual ~color_reductor();  // doesn't kills input_file
  33.     virtual  int pass1();         // returns -1 if error
  34.         // after pass1() we're ready for pass2
  35.     void process_line(int line_n, BYTE *out_line);
  36.         // one line of pass2
  37. };
  38.  
  39. void refresh(int i,BOOL pass2);
  40. #endif